/****************************************************************
 * Homework 7 Main program
 * Author: Andrew Shore, Wes Ring, JC Anderson, Colin Edwards
 * Modified by: Brett Shofner, Donald Lemaster, Byron Alleman
 * Date last modified: 20 April 2010
 *
 * This main program simply takes in a filename argument and passes the
 * file as a stream to runSimulation function of the Scheduler class. 
 * 
 * First the name of the file that contains the maximum start time 
 * of the initial pendingQ, the maximum number of processes with the 
 * same starting time in the initial pendingQ, the maximum execution 
 * time of each process in the initial PendingQ, the number of time 
 * steps to run the simulation for, the maximum number of new processes
 * generated per time step, the maximum difference between the current
 * time step and a new generated process's start time, and the frequency
 * at which to display mean and standard deviation data is read from 
 * the command line. Note if the number of timesteps read is -1 then 
 * the simulation is run for the maximum long value, so essentially 
 * forever for all intents and purposes. 

 * An input stream is opened for the file containing the information, 
 * then the file stream is passed to the runSimulation function.
 * Finally the file streams are closed and the program ends.
 *
 * Input: none
 *
 * Output: only a log of what takes place
**/
#include "Main.h"

static const char TAG[] = "Main: ";

int main(int argc, char *argv[])
{
  cout << TAG << "Beginning execution" << endl; 

  ifstream inStream;
  Scheduler theScheduler;

  Utils::CheckArgs(1, argc, argv, "input file");
  Utils::FileOpen(inStream, argv[1]);
  
  cout << "Take processes from file '" << argv[1] << "'\n";

  theScheduler.runSimulation(inStream);
 
  Utils::FileClose(inStream);
  
  cout << TAG << "Ending execution" << endl;
  return 0;
}
